using System;
using System.Collections.Generic;
using System.Text;

namespace Kopain
{

    /// <summary>This class is the Kopain version of the status bar.
    /// The idea is to have the main form not bother about the internals of a statusbar
    /// but only have to make simple method calls.
    /// </summary>
    internal class KopainStatusstrip : System.Windows.Forms.StatusStrip
    {

        /// <summary>This is the control to show the filename for the chosen Note.
        /// </summary>
        private System.Windows.Forms.ToolStripStatusLabel _lblFilename;
        private System.Windows.Forms.ToolStripStatusLabel _lblPath;

        /// <summary>The constructor.  I think this should be done at the Load event or something but it seems I cannot find it.
        /// </summary>
        public KopainStatusstrip()
        {
            //  Add the controls/items to the statusbar.
            //
            _lblPath = new System.Windows.Forms.ToolStripStatusLabel();
            _lblFilename = new System.Windows.Forms.ToolStripStatusLabel();
            Items.AddRange( new System.Windows.Forms.ToolStripItem[] { _lblPath, _lblFilename } );

            //  Setup the path label.
            //
            _lblFilename.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
            _lblFilename.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.All;
            _lblFilename.Name = "lblFilename";
            _lblFilename.Size = new System.Drawing.Size( 109, 17 );
            _lblFilename.Text = "";

            // Setup the filename label.
            // 
            _lblFilename.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
            _lblFilename.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.All;
            _lblFilename.Name = "lblFilename";
            _lblFilename.Size = new System.Drawing.Size( 109, 17 );
            _lblFilename.Text = "";

        }

        /// <summary>This method sets the path.
        /// </summary>
        /// <param name="path"></param>
        internal void SetPath( string path )
        {
            if( _lblPath.Text != path )
            {
                _lblPath.Text = path;
            }
        }
        
        /// <summary>This method sets the filename.
        /// </summary>
        /// <param name="filename"></param>
        internal void SetFilename( string filename ){
            if( _lblFilename.Text != filename )
            {
                _lblFilename.Text = filename;
            }
        }

    }
}
